package file;

import java.io.File;
import java.io.FilenameFilter;
import java.util.regex.Pattern;

public class FileName implements FilenameFilter{
	private Pattern pattern;
	static String regex="[\\.java]$";
	public FileName(String regex){
		pattern=Pattern.compile(regex);
	}
	@Override
	public boolean accept(File file, String name) {
		return pattern.matcher(name).matches();
	}
	public static void main(String[] args) {
		String name="D:\\gitmybatis\\good\\good\\src\\main\\java\\com\\good\\adminController";
		File file=new File(name);
		String[] strings=file.list();
		System.out.println(strings.length);
		for (String string : strings) {
			System.out.println(string);
		}
	}

}
